# 词云生成

import wordcloud
import jieba
# paragraph = '''梦觉透窗风一线,寒流灯吹息。那堪酒醒,又闻空阶夜雨频滴。嗟因循、久
# 作天涯客。负佳人、几许盟言，便忍把、从前欢会，陡顿翻成忧戚。
# 愁极，再三追思,洞房深处,几度饮散歌阑，香暖鸳鸯被。岂暂时疏散，费
# 伊心力。殢云尤雨，有万般千种，相怜相惜。'''
# words = jieba.lcut(paragraph)
# txt = " ".join(words)
# print(txt)
# w = wordcloud.WordCloud(width= 1000, height= 1000, background_color= "white", font_path="/Library/Fonts/Songti.ttc")
# w.generate(txt)
# w.to_file("demo.png")

# 这个题尤其恶心，OJ 没有提供测试文件，之前的测试文件和测试样例也多有不规范
# import jieba
# import wordcloud
# f1= open("sy9//宋词.txt", "r")
# #代码开始
# lines = f1.readlines()
# string = ""
# for line in lines:
#     string += line
# string = jieba.lcut(string)
# string = " ".join(string)
# w = wordcloud.WordCloud(width=1000, height=700, background_color= "white", font_path="sy9//simhei.ttf", max_words=300)
# w.generate(string)
#
# #代码结束
# # f1 = open("sy9//pict//sc1.png", "rb")
# w.to_file("sy9//pict//sc1.png")
